<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>获取完整的日期和时间</title>
</head>
<body>
    <script>
        //获取完整的年月日
        var d = new Date().toLocaleDateString();
        console.log(d);
        //获取完整的时分秒
        var t = new Date().toLocaleTimeString();
        console.log(t);
        //获取完整的年月日 时分秒
        var dt = new Date(1590000000000).toLocaleString();
        console.log(dt);
    </script>
</body>
</html>